// Tags: DP on Tree
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <vector>

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

typedef long long ll;

const int N = 1e5 + 5;
int n, dep[N], son[N];
std::vector<int> e[N];
ll *f[N], *g[N], p[N << 2], *o = p, ans;

void dfs(int x, int fa) {
  for (auto y : e[x])
    if (y != fa) {
      dfs(y, x);
      if (dep[y] > dep[son[x]]) son[x] = y;
    }
  dep[x] = dep[son[x]] + 1;
}

void solve(int x, int fa) {
  if (son[x]) f[son[x]] = f[x] + 1, g[son[x]] = g[x] - 1, solve(son[x], x);
  f[x][0] = 1, ans += g[x][0];
  for (auto y : e[x])
    if (y != fa && y != son[x]) {
      f[y] = o, o += dep[y] << 1, g[y] = o, o += dep[y] << 1;
      solve(y, x);
      for (int i = 0; i < dep[y]; i++) {
        if (i) ans += f[x][i - 1] * g[y][i];
        ans += g[x][i + 1] * f[y][i];
      }
      for (int i = 0; i < dep[y]; i++) {
        g[x][i + 1] += f[x][i + 1] * f[y][i];
        if (i) g[x][i - 1] += g[y][i];
        f[x][i + 1] += f[y][i];
      }
    }
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3565 [POI2014]HOT-Hotels.in", "r", stdin);
  freopen("P3565 [POI2014]HOT-Hotels.out", "w", stdout);
#endif
#endif

  read(n);
  for (int i = 1, x, y; i < n; i++)
    read(x), read(y), e[x].push_back(y), e[y].push_back(x);
  dfs(1, 0), f[1] = o, o += dep[1] << 1, g[1] = o, o += dep[1] << 1;
  solve(1, 1);
  printf("%lld", ans);
  return 0;
}